<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title><{:C('SYSTEM_NAME')}></title>
<include file="Common:head"/>
<style type="text/css">
body{ background: url();
	background-size:cover }
</style>
</head>
<body>
<div class="login-wrap">
	<div class="login-box">
		<h1  class="tit center" style="color: white"><{:C('SYSTEM_NAME')}></h1>
		<div class="login-con center">
			<form id='form' method="post">
				<p class="tips">用户名与密码不匹配</p>
				<p class="mb20"><input type="text" class="item-ipt focus" id="login_name" name="name" value="" placeholder="请输入您的用户名"/></p>
				<p class="mb40"><input type="password" class="item-ipt" id="login_password"  name="password" value="" placeholder="请输入密码"/></p>
				<p><a href="javascript:void(0);" class="pro-btn" data-options="handler:login" onclick="login()">登 录</a></p>
			</form>
			<div style="margin: 10px;">
				<img style="display: inline-block;margin:10px;"  src="" width="40%" alt="">
				<img style="display: inline-block;margin:10px;"  src="" width="40%" alt="">
			</div>
			<div>
				<span style="display: inline-block;width:40%;font-size: 15px;color: black">Android</span>
				<span style="display: inline-block;width: 40%;font-size: 15px;color: black">IOS</span>
			</div>

		</div>
	</div>
</div>
<div style="position: absolute;bottom: 5px;;width: 100%;text-align: center"><p style="color:white">2017-2020 © Copyright. 深圳众乐智府科技有限公司 - All Rights Reserved</p></div>

<script type="text/javascript">

$(function(){
	$('input:text:first').focus();
	clearTip();
	$('form').keyup(function(event){

		if(event.keyCode ==13){
			login();
		}
		//if(event.keyCode != 13 ) clearTip();
	});
	$("#login_name").bind('input propertychange',function(){
		$("#form .tips").html('');
	});

	$("#login_password").bind('input propertychange',function(){
		$("#form .tips").html('');
	});
});

function clearTip(){
	//console.log('==');
	$("#form .tips").html('');
}
function changeCode(){
	var that = document.getElementById('code_img');
	that.src = that.src + '&' + Math.random();
}


function login(){
	var isValid = $('.login-box  .login-form').form('validate');
	//if (!isValid) return false;
	var username = $('#login_name').val();
	var login_password = $('#login_password').val();
	var req_context = {username:username,password:login_password};
	$.messager.progress({text:'登录中，请稍候...'});
	$.post('<{:U('admin/Index/login?dosubmit=1')}>', req_context, function(data){
		$.messager.progress('close');
		//console.log(data);
		if(!data.status){
			$(".tips").html(data.info);
			//$.app.method.tip('提示信息', data.info, 'error');
			//changeCode();
		}else{
			window.location.href = data.url;
		}
	},'json');
	return false;
}
</script>
</body>
</html>
